package CtrLayer;
import ModLayer.ProductCon;
import ModLayer.Product;
import ModLayer.TimeAndCheck;
import java.util.ArrayList;

/**
 * Write a description of class ProductCtr here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class ProductCtr
{
    private ProductCon productCon;
    private TimeAndCheck time;
    public static ProductCtr instance;
    
    private ProductCtr()
    {
        productCon = productCon.getInstance();
        time = time.getInstance();
    }
    
    public static ProductCtr getInstance()
    {
        if(instance==null)
            instance = new ProductCtr();
        return instance;
    }
    
    public void createProduct( String id, String description, boolean sell, 
    boolean lease, double price, double leaseprice,int stockDIY, int stockBath, 
    int stockKit)
    {
        productCon.createProduct(id, time.getNoForCustomer(), description, 
        sell, lease, price, leaseprice, stockDIY, stockBath, stockKit);
    }
    
    public void deleteProduct(String id)
    {
        Product pr = productCon.findProduct(id);
        productCon.deleteProduct(pr);
    }
    
    public ArrayList<Product> searchProduct()
    {
        return productCon.searchProduct();
    }
    
    public Product findProduct(String id)
    {
        return productCon.findProduct(id);
    }
    
    public Product findProductn(String id)
    {
        return productCon.findProductn(id);
    }
}